const Layout = () => import('@/views/Layout/index.vue')
const Login = () => import('@/views/Login/index.vue')
const Home = () => import('@/views/Home/index.vue')
const Category = () => import('@/views/Category/index.vue')
const SubCategory = () => import('@/views/SubCategory/index.vue')
const GoodsDetail = () => import('@/views/GoodsDetail/index.vue')
const ShopCart = () => import('@/views/ShopCart/index.vue')
const Checkout = () => import('@/views/Checkout/index.vue')
const Pay = () => import('@/views/Pay/index.vue')
const PayResult = () => import('@/views/PayResult/index.vue')
const MemberCenter = () => import('@/views/MemberCenter/index.vue')
const User = () => import('@/views/MemberCenter/components/User.vue')
const Order = () => import('@/views/MemberCenter/components/Order.vue')

const routes = [
	{
		path: '/',
		component: Layout,
		redirect: '/home',
		children: [
			{
				path: 'home',
				component: Home,
			},
			{
				name: 'category',
				path: 'category/:id',
				component: Category,
			},
			{
				name: 'subCategory',
				path: 'category/sub/:id',
				component: SubCategory,
			},
			{
				path: 'goods-detail/:id',
				component: GoodsDetail,
			},
			{
				path: 'shop-cart',
				component: ShopCart,
			},
			{
				path: 'checkout',
				component: Checkout,
			},
			{
				path: 'pay',
				component: Pay,
			},
			{
				path: 'paycallback',
				component: PayResult,
			},
			{
				path: 'member-center',
				component: MemberCenter,
				redirect: '/member-center/user',
				children: [
					{
						path: 'user',
						component: User,
					},
					{
						path: 'order',
						component: Order,
					},
				],
			},
		],
	},
	{
		path: '/login',
		component: Login,
	},
]

export default routes
